package com.gdpu.liou.symphonyserver.mapper;

import com.gdpu.liou.symphonyserver.entity.Rank;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Repository
public interface RankMapper {
    /**
     * @param playlistId 歌单id
     * @param consumerId 用户id
     * @param score 评分
     * @return a
     */
    boolean gradePlaylist(@Param("playlistId") Long playlistId,
                          @Param("consumerId") Long consumerId,
                          @Param("score") Integer score);

    List<Map<String,String>> selectAvgScoreOfPlaylists();


    /**
     * @param playlistId 歌单id
     * @return 返回歌单平均分
     */
    Double selectAvgScoreOfPlaylist(@Param("playlistId") Long playlistId);


    /**
     * @param consumerId 用户id
     * @return 返回用户评分
     */
    Double selectGradeOfPlaylistOfConsumer(@Param("playlistId") Long playlistId, @Param("consumerId") Long consumerId);
}
